import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author gaopeng
 * @date 2019/12/17 10:28 下午
 */
public class Caretaker {
    private static final int SIZE = 3;
    private int custer = 1;
    private Map<String,IMemento> map = new HashMap<>(SIZE);

    public void setMemento(IMemento memento){
        map.put(custer+"",memento);
        if(custer==SIZE){
            custer = 1;
        }else{
            custer++;
        }
    }

    public IMemento getMemento(String  index){
        return map.get(index);
    }

    public Set<String> getIndexs(){
        return map.keySet();
    }

}
